
import Sprite = Laya.Sprite;
import Tween = Laya.Tween;
import Image = Laya.Image
import Common from "../Common/Common";
// 发射器小球页面类逻辑
export default class Ball extends Laya.Sprite {
    [x: string]: any;

    constructor() {
        super()


    }

    // 飞机生成方法
    public ball(): Image {
        let ball_small = new Image();
        // ball_small.graphics.drawCircle(0, 0, 20, "#5695DC");
        if (Common.getCacheItem("character") == null) {
            var character = "images/character1.png"
        } else {
            var character = "images/character" + Common.getCacheItem("character") + ".png"
        }
        ball_small.skin = character
        ball_small.x = 540;
        // ball_small.y = 1866
        ball_small.bottom = 60
        console.log("earth:",this.earth)
        Laya.stage.addChild(ball_small)
        if (Common.getCacheItem("character") == "1" || Common.getCacheItem("character") == null) {
            ball_small.width = 140
            ball_small.height = 80
            ball_small.pivotX = 70
            ball_small.pivotY = 40
        }else if(Common.getCacheItem("character") == "2"){
            ball_small.width = 140
            ball_small.height = 140
            ball_small.pivotX = 70
            ball_small.pivotY = 70
        }else if(Common.getCacheItem("character") == "3" || Common.getCacheItem("character") == "4"){
            ball_small.width =80
            ball_small.height = 140
            ball_small.pivotX = 40
            ball_small.pivotY = 70
        }else if(Common.getCacheItem("character") == "5" || Common.getCacheItem("character") == "6"){
            ball_small.width = 100
            ball_small.height = 140
            ball_small.pivotX = 50
            ball_small.pivotY = 70
        }
        ball_small.zOrder = 2
        console.log(ball_small);
        return ball_small;

    }


}